package com.api.shihua.cmd;



import com.api.shihua.entity.Reward;
import com.api.shihua.service.InsertHrBaseService;
import com.api.shihua.util.BaseUtil;
import com.api.shihua.util.LogTool;
import weaver.general.Util;

import java.util.List;
import java.util.Map;

public class RewardBaseService extends InsertHrBaseService<Reward> {
    private final static LogTool log = new LogTool("/log/hr/",false);
    @Override
    public String getObjMapList(List<Object> business,List<Map<String, Object>> listMap){
        List<Map<String, Object>> map=null;
        try {
            map=PaseModeByAnnoList(business,listMap);
        } catch (Exception e) {
            e.printStackTrace();
        }
        if(map==null||map.size()<=0){
            return "获取对象异常";
        }else{
            log.writeLog(map.toString());
        }
        //执行插入的动作
        String datasource=(String)map.get(0).get("datasource");
        if(datasource==null||"".equals(Util.null2String(datasource))){
            datasource="cssql";
        }
        log.writeLog("datasource--->"+datasource);
        boolean flag= BaseUtil.executeUpdateListTran(datasource,map);
        if(!flag){
            return "未写入成功";
        }
        return "";
    }
}
